#include <errno.h>
#include <sched.h>

struct switch_info {
	int previous_pid;
	int next_pid;
	int previous_policy;
	int next_policy;
	unsigned long time;
	int reason;
};

int is_brr(int pid) {
        long __res;
        __asm__ volatile (
        "movl $243, %%eax;"
        "movl %1, %%ebx;"
        "int $0x80;"
        "movl %%eax,%0"
        : "=m" (__res)
        : "m" (pid)
        : "%eax","%ebx"
        );
                if ((unsigned long)(__res) >= (unsigned long)(-125)) {
        errno = -(__res);
        __res = -1;
        }
        return (int)(__res);
}

int  get_scheduling_statistic(struct switch_info *si){
	int __res;
	__asm__ volatile (
		"movl $244, %%eax;"
		"movl %1, %%ebx;"
		"int $0x80;"
		"movl %%eax,%0"
		: "=m" (__res)
		: "m" (si)
		: "%eax","%ebx"
		);
	if ((unsigned long)(__res) >= (unsigned long)(-125)) {
		errno = -(__res);
		__res = -1;
	}
	return __res;
}

